#include <math.h>
#include <stdio.h>
#include "snipmath.h"

double d1_mul(double a, double b) {
  
  *(double *)ADDR_MUL1 = a;
  *(double *)ADDR_MUL2 = b;

  return *(double*) ADDR_MULR1;
}

double d2_mul(double a, double b) {
  
  *(double *)ADDR_MUL3 = a;
  *(double *)ADDR_MUL4 = b;

  return *(double *)ADDR_MULR2;
}

double d1_add(double a, double b) {

  *(double *)ADDR_ADD1 = a;
  *(double *)ADDR_ADD2 = b;

  return *(double *)ADDR_ADDR1;
}

double d2_add(double a, double b) {

  *(double *)ADDR_ADD3 = a;
  *(double *)ADDR_ADD4 = b;

  return *(double *)ADDR_ADDR2;
}

double d1_div(double a, double b) {

  *(double *)ADDR_DIV1 = a;
  *(double *)ADDR_DIV2 = b;

  return *(double *)ADDR_DIVR1;
}

double d2_div(double a, double b) {

  *(double *)ADDR_DIV3 = a;
  *(double *)ADDR_DIV4 = b;

  return *(double *)ADDR_DIVR2;
}

double d_sqrt(double a) {

  *(double *)ADDR_SQRT1 = a;

  return *(double *)ADDR_SQRTR;
}

double d_pow(double a, double b) {

  *(double *)ADDR_POW1 = a;
  *(double *)ADDR_POW2 = b;

  return *(double *)ADDR_POWR;
}
